{{#section 'style'}}<link rel="stylesheet" href="/style/book.css">{{/section}}


<div class="techbook bookList">
    <!--head-->
    {{> header_list}}
    <!--head End-->

    <!--body-->
    <div class="body">
        <div class="wrap">
            {{#if books.length}}
                <dl class="bLAllType">
                    <dt>全部<i></i></dt>
                    <dd>
                        <a href="">图书排行榜</a><a href="" class="hl">图书排行榜</a><a href="">图书排行榜</a><a href="">图书排行榜</a><a href="">图书排行榜</a><a href="">图书排行榜</a><a href="">图书排行榜</a><a href="">图书排行榜</a><a href="">图书排行榜</a><a href="">图书排行榜</a>
                    </dd>
                </dl>

                <div class="commendatoryTab booksListTab" id="booksListTab">
                    <div class="tabs">
                        <div class="fr bar">
                            <div class="search fl">
                                <input type="text" class="word">
                                <input type="submit" value="" class="btn">
                            </div>
                            <div class="booksListPage fl" id="booksListPage">
                                <div class="count">共<b>{{page.count}}</b>件商品</div>
                                <div class="curr"><em>{{page.curr}}</em>/{{page.total}}</div>
                                <div class="btn">
                                    {{#if page.isFirst}}
                                        <span class="prev disabled">&lt;</span>
                                    {{else}}
                                        <a href="{{page.uri}}&page={{page.prev}}" class="prev">&lt;</a>
                                    {{/if}}
                                    {{#if page.isLast}}
                                        <span class="next disabled">&gt;</span>
                                    {{else}}
                                        <a href="{{page.uri}}&page={{page.next}}" class="next">&gt;</a>
                                    {{/if}}
                                </div>

                            </div>
                        </div>
                        <div class="list">
                            <a href="/search?keyword={{keyword}}&sort={{numbers.comprehensive}}"{{#if curr.comprehensive}} class="tabCurr"{{/if}}>综合排序</a>
                            <a href="/search?keyword={{keyword}}&sort={{numbers.sales}}"{{#if curr.sales}} class="tabCurr"{{/if}}>销量</a>
                            <a href="/search?keyword={{keyword}}&sort={{numbers.price}}" class="{{#if curr.price}} tabCurr{{/if}}{{#if priceSort.asc}} asc{{/if}}{{#if priceSort.desc}} desc{{/if}}">价格</a>
                            <a href="/search?keyword={{keyword}}&sort={{numbers.commentCount}}"{{#if curr.commentCount}} class="tabCurr"{{/if}}>评论数</a>
                            <a href="/search?keyword={{keyword}}&sort={{numbers.putaway}}"{{#if curr.putaway}} class="tabCurr"{{/if}}>上架时间</a>
                        </div>
                    </div>
                    <div class="tabCons">
                        <div class="tabCon tabConCurr">
                            <div class="booksListList" id="booksListList">
                                {{>book_list}}
                            </div>
                            <div class="cb"></div>

                            {{>page page}}

                        </div>
                    </div>

                </div>
            {{else}}
                <div class="booksListNoData">
                    <p>列表是空的噢~</p>
                    <div><a href="/" class="to">去首页看看</a></div>
                </div>
            {{/if}}
        </div>
    </div>
    <!--body End-->

    <!--foot-->
    {{>footer}}
    <!--foot End-->

    <!--sideBar-->

    <!--sideBar End-->

</div>

{{#section 'script'}}
    <script>
        $(function(){
            //列表排序
            $('.booksListTab').on('click','.tabs .list span', function () {
                $(this).addClass('tabCurr').siblings().removeClass('tabCurr');
            });

            //类目导航
            $('#menuList').on({
                mouseenter: function () {
                    $(this).addClass('open');
                },
                mouseleave: function () {
                    $(this).removeClass('open');
                }
            },'dl');

            //楼层左侧TopN书籍Toggle
            $('.sideBookList').sideBookListToggle();

            //page跳转
            (function () {
                var $page=$('#page'),$ipt=$page.find('.skip .ipt'),$btn=$page.find('.skip .btn'),total={{page.total}};
                $ipt.on('keyup', function (e) {
                    if(13== e.keyCode){
                        $btn.trigger('click');
                    }
                });
                $btn.on('click',function(){
                    var val=$ipt.val();
                    val=Number(val) || 1;//包括0和非数值
                    val=val>total?total:val;
                    var url="/list?catId={{cat.id}}&sort={{page.sort}}&page="+val;
                    window.location.href=url;
                });
            })();

        });
    </script>
{{/section}}